<fieldset xmlns="http://www.w3.org/1999/xhtml" 
          xmlns:py="http://genshi.edgewall.org/"
          id="${id}"
          class="${css_class}"
          py:attrs="attrs" >
    <legend py:if="legend" py:content="legend" />
    <div class="fielderror" py:if="error and show_error" py:content="error" />
    <div py:if="hidden_fields">
        <div py:for="field in hidden_fields"
             py:with="field_error=error_for(field)"
             py:strip="True">
            <span py:replace="field.display(value_for(field), **args_for(field))" />
            <span py:if="show_children_errors and field_error and not field.show_error" 
                  class="fielderror" py:content="field_error" />
        </div>
    </div>
    <table border="0" cellspacing="0" cellpadding="2" py:attrs="table_attrs">
        <tbody>
            <tr py:for="i, field in enumerate(fields)" 
                id="${field.id}.container"
                class="${i%2 and 'odd' or 'even'}"
                title="${hover_help and help_text or ''}"
                py:attrs="args_for(field).get('container_attrs') or field.container_attrs"
                py:with="required=[None,' required'][int(field.is_required)]; 
                         field_error=error_for(field);
                         label_text = field.label_text;
                         help_text = field.help_text;" >
                <td valign="top" py:if="show_labels and not field.suppress_label" class="labelcol">
                    <label py:if="label_text" id="${field.id}.label" for="${field.id}" 
                           class="fieldlabel${required}" py:content="label_text" />
                </td>
                <td class="fieldcol" py:attrs="show_labels and field.suppress_label and dict(colspan=2)">
                    ${field.display(value_for(field), **args_for(field))}
                    <span py:if="help_text and not hover_help" class="fieldhelp" py:content="help_text" />
                    <span py:if="show_children_errors and field_error and not field.show_error" class="fielderror" py:content="field_error" />
                </td>
            </tr>
        </tbody>
    </table>
    <span py:if="error and not error.error_dict" class="fielderror" py:content="error" />
    <span><a id="minus3" href="">[-]</a> <a id="plus3" href="">[+]</a></span>
</fieldset>
